package com.wxq.ams.backup.constants;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

public class BackupConstants {
    /**
     * 备份目录名称
     */
    public static final String BACKUP_FOLDER_NAME = "backup";

    /**
     * 备份文件路径
     */
    public static final String BACKUP_FOLDER = System.getProperty("user.dir") + "\\ams-backup\\src\\main\\resources\\" + BACKUP_FOLDER_NAME;

    /**
     * 还原目录，默认就是备份目录
     */
    public static final String RESTORE_FOLDER = BACKUP_FOLDER;
    /**
     * 日期格式
     */
    public static final String DATE_FORMAT = "yyyy-MM-dd_HHmmss";
    /**
     * SQL拓展名
     */
    public static final String SQL_EXT = ".sql";

    /**
     * 备份文件名
     */
    public static final String BACKUP_FILE_NAME() {
        String time = new SimpleDateFormat(BackupConstants.DATE_FORMAT).format(new Date());
        return "ams_" + time + SQL_EXT;
    }

    /**
     * 默认备份文件名
     */
    public static final String DEFAULT_BACKUP_FILE_NAME = "ams" + SQL_EXT;
    /**
     * 默认备份还原目录名称
     */
    public static final String DEFAULT_BACKUP_NAME = "backup";
    /**
     * 默认备份还原文件
     */
    public static final String DEFAULT_RESTORE_FILE = BACKUP_FOLDER + DEFAULT_BACKUP_NAME + File.separator + DEFAULT_BACKUP_FILE_NAME;
}
